package com.jy.qnbbs;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class QnbbsConsumerRemoveEureka {

    /** 配置负载均衡策略
     * 策略类在
     * com.netflix.ribbon:ribbon-loadbalancer 依赖下面的 com.netflix.loadbalancer 包里
     * 默认是轮询策略
     * 以下是随机策略
     */
    @Bean
    public IRule ribbon(){
        return new RandomRule();
    }

    public static void main(String[] args) {
        SpringApplication.run(QnbbsConsumerRemoveEureka.class,args);
    }

}
